#plotting format
plotformat = theme(plot.title = element_text(face="bold",size = 17,hjust = 0.5),axis.title = element_text(face = "bold",size =15), axis.text.x = element_text(size=12), axis.title.y=element_text(size=14))+theme_bw()
theme_facet = function(base_size = 14, base_family = "Helvetica") {
# Starts with theme_grey and then modify some parts
theme_bw(base_size = base_size, base_family = base_family) %+replace%
theme(
strip.background = element_blank(),
strip.text.x = element_text(size = 10),
strip.text.y = element_text(size = 10),
axis.text.x = element_blank(),
axis.text.y = element_text(size=12,hjust=1),
axis.ticks = element_blank(), #element_line(colour = "black"),
axis.title.x= element_text(size=12),
axis.title.y= element_text(size=12,angle=90),
panel.background = element_blank(),
panel.border =element_blank(),
panel.grid.minor = element_blank(),
panel.spacing = unit(0.5, "lines"),
plot.background = element_blank(),
plot.margin = unit(c(0.3, 0.3, 0.3, 0.3), "lines"),
axis.line.x = element_line(color="black", size = 0.5),
axis.line.y = element_line(color="black", size = 0.5)
)
}
#color
Features = c('#deebf7','#9ecae1','#6baed6','#4292c6','#08519c','#08306b',
'#fee6ce','#fdae6b','#fd8d3c','#f16913','#a63603','#7f2704',
'#f0f0f0','#bdbdbd','#969696','#737373','#252525','#000000',
'#efedf5','#bcbddc','#9e9ac8','#807dba','#54278f','#3f007d')
dataPath = '/Volumes/Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/Prolificdata/newDesignV9_001/';
SameDifferent_fnames = list.files(path = dataPath,pattern = "SameDifferent")
Demo_fnames = list.files(path = dataPath,pattern = "demographics")
Post_fnames = list.files(path = dataPath,pattern = "postsurvey")
postsurvey_new_fname = "postsurvey_newDesignV8"
d_p_thre = 0.5
trial_thre = 42
age_thre = 35
Load data
##specify variables
#for behavior information
completeFnames =list()
totalData = data.frame()
ic = 1;
#for demographic information
gender = data.frame()
age = data.frame()
ethnicity= data.frame()
race = data.frame()
subID = data.frame()
#for post survey
Postsurvey=data.frame()
Postsurvey_feature = data.frame()
prolificID = data.frame()
confirmationCode = data.frame()
PostsubID=data.frame()
##Getting data from online text output
for (ifiles in 1:length(SameDifferent_fnames)){
tempFile = read.table(paste0(dataPath,SameDifferent_fnames[ifiles]),header = F)
Trials = unlist(strsplit(as.character(tempFile$V1), ";"))
if (length(Trials)>10){
keyNum = data.frame()
accuracy = data.frame()
feature_index = data.frame()
RT = data.frame()
Fir_img = data.frame()
Sec_img = data.frame()
for (i in 1:length(Trials)){
temp = unlist(strsplit(Trials[i],","));
keyNum = rbind(keyNum,as.numeric(temp[2]))
accuracy = rbind(accuracy,as.numeric(temp[4]))
RT = rbind(RT,as.numeric(temp[5]))
feature_index = rbind(feature_index,as.numeric(temp[6]))
Fir_img = rbind(Fir_img,as.numeric(temp[7]))
Sec_img = rbind(Sec_img,as.numeric(temp[8]))
}
data = cbind(keyNum,accuracy,RT, feature_index,Fir_img,Sec_img)
colnames(data) = c("keys","accuracy", "rt","feature_index", "Fimg","Simg")
data = data[-1,]
data$subID = ifiles;
data$trialNum = 1:dim(data)[1];
totalData = rbind(totalData,data)
#Getting demo data
for (ifilesDe in 1:length(Demo_fnames)){
if (unlist(strsplit(SameDifferent_fnames[ifiles],"SameDifferent"))[2]==unlist(strsplit(Demo_fnames[ifilesDe],"demographics"))[2]){ tempDemoFile = read.table(paste0(dataPath,Demo_fnames[ifilesDe]),header = F)
Demo_info = unlist(strsplit(as.character(tempDemoFile$V1), ";"))
gender[ic,1] = unlist(Demo_info[1])
age[ic,1]=unlist(Demo_info[2])
ethnicity[ic,1]=unlist(Demo_info[3])
race[ic,1]=unlist(Demo_info[4])
subID[ic,1]=unlist(ifiles)
}# if
}#for
##Getting post-test data
for (ifilesDe in 1:length(Post_fnames)){
if (unlist(strsplit(SameDifferent_fnames[ifiles],"SameDifferent"))[2]==unlist(strsplit(Post_fnames[ifilesDe],"postsurvey"))[2]){ tempPostFile = read.table(paste0(dataPath,Post_fnames[ifilesDe]),header = F)
###separate feedback and prolific ID
if (dim(tempPostFile)[2]>1){
tempPostFile$y = apply( tempPostFile[,] , 1 , paste , collapse = "" )
Post_info = unlist(strsplit(as.character(tempPostFile$y), ";"))
}else{
Post_info = unlist(strsplit(as.character(tempPostFile$V1), ";"))
}
Postsurvey[ic,1]=unlist(Post_info[1])
prolificID[ic,1] = unlist(Post_info[2])
Postsurvey_feature[ic,1]=feature_index[2,]
confirmationCode[ic,1]=unlist(strsplit(SameDifferent_fnames[ifiles],"SameDifferent"))[2]
PostsubID[ic,1]=unlist(ifiles)
}#if
}#for
completeFnames[ic] =unlist(strsplit(SameDifferent_fnames[ifiles],"SameDifferent"))[2]
ic = ic+1;
}else{
}
}#for
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferent0MfRSXTH.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographics0MfRSXTH.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurvey0MfRSXTH.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferent2VreB2kM.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographics2VreB2kM.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurvey2VreB2kM.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferent7RW33qks.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographics7RW33qks.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurvey7RW33qks.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferent9dLfnEXJ.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographics9dLfnEXJ.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurvey9dLfnEXJ.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferent9PIfsrVJ.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographics9PIfsrVJ.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurvey9PIfsrVJ.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferent9siroRzf.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographics9siroRzf.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurvey9siroRzf.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferenta2wTDNL7.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsa2wTDNL7.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveya2wTDNL7.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentaBneeMU6.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsaBneeMU6.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyaBneeMU6.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentaJ5ZKNel.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsaJ5ZKNel.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyaJ5ZKNel.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferenteIPGSbpq.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicseIPGSbpq.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyeIPGSbpq.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentfenNmzOU.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsfenNmzOU.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyfenNmzOU.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentiBwKaCjs.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsiBwKaCjs.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyiBwKaCjs.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentIiOEeQy6.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsIiOEeQy6.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyIiOEeQy6.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentJGrMaCmP.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsJGrMaCmP.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyJGrMaCmP.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentJlw1YMtG.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsJlw1YMtG.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyJlw1YMtG.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentKLBKEK3F.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsKLBKEK3F.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyKLBKEK3F.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentlqpK5489.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicslqpK5489.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveylqpK5489.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentMlvaoQ2n.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsMlvaoQ2n.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyMlvaoQ2n.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentmtNgbWLE.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsmtNgbWLE.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveymtNgbWLE.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentNSVI51Kf.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsNSVI51Kf.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyNSVI51Kf.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentO1TOg8A2.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsO1TOg8A2.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyO1TOg8A2.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentoacujUVx.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsoacujUVx.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyoacujUVx.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentOWerYd0m.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsOWerYd0m.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyOWerYd0m.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentPfKvehWe.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsPfKvehWe.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyPfKvehWe.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentphBeNqhr.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsphBeNqhr.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyphBeNqhr.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentQA4phCWA.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsQA4phCWA.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyQA4phCWA.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentssCWUNDy.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsssCWUNDy.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyssCWUNDy.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentSyT3ZjNE.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsSyT3ZjNE.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveySyT3ZjNE.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentuFeg5Yy5.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsuFeg5Yy5.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyuFeg5Yy5.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentuU3PUUft.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsuU3PUUft.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyuU3PUUft.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentV7y43Utm.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsV7y43Utm.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyV7y43Utm.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentwgRz7ClB.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicswgRz7ClB.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveywgRz7ClB.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentxaVhbvdC.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsxaVhbvdC.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyxaVhbvdC.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentY8ES78TU.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsY8ES78TU.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyY8ES78TU.txt'
## Warning in read.table(paste0(dataPath, SameDifferent_fnames[ifiles]),
## header = F): incomplete final line found by readTableHeader on '/Volumes/
## Macintosh HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/
## Calibration/Prolificdata/newDesignV9_001/SameDifferentZ5wdPGSI.txt'
## Warning in read.table(paste0(dataPath, Demo_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/demographicsZ5wdPGSI.txt'
## Warning in read.table(paste0(dataPath, Post_fnames[ifilesDe]), header =
## F): incomplete final line found by readTableHeader on '/Volumes/Macintosh
## HD/Users/Pam_sf_wang/Documents/Perceptual_learning_project/Calibration/
## Prolificdata/newDesignV9_001/postsurveyZ5wdPGSI.txt'
#demographic information
demographic_information = cbind(gender,age,ethnicity,race,subID)
colnames(demographic_information) = c("Gender","Age","Ethnicity","Race","SubID")
demographic_information$Age = as.numeric(demographic_information$Age)
#save post test survey
postsurvey = cbind(Postsurvey,Postsurvey_feature,prolificID,PostsubID,confirmationCode)
colnames(postsurvey) = c("post_surve","feature","prolificID","SubID","confirm_code")
#write.csv(postsurvey, file = paste0(postsurvey_new_fname,".csv"))
Identify and remove outliers
summarize = dplyr::summarize
#check basic performance -- remove non-responding subjects
temp = totalData %>% group_by(subID) %>% summarize(num_noresponses= sum(keys==-1), trialNum = length(subID))
sprintf("total trial number: %i; Number of subjects %i",temp$trialNum[1],dim(temp)[1])
## [1] "total trial number: 84; Number of subjects 35"
temp
## # A tibble: 35 x 3
## subID num_noresponses trialNum
## <int> <int> <int>
## 1 1 22 84
## 2 2 0 84
## 3 3 1 84
## 4 4 2 84
## 5 5 0 84
## 6 6 1 84
## 7 7 1 84
## 8 8 0 84
## 9 9 0 84
## 10 10 2 84
## # ... with 25 more rows
ggplot(temp, aes( y= num_noresponses, x= subID))+
geom_point()+
geom_hline(yintercept=trial_thre, linetype="dashed", color = "red", size=0.5)+
labs(title="No responses", x ="subjuect ID", y = "number of no responses")+
plotformat

#check feature number
tempFeature = totalData %>% group_by(subID) %>%summarize(feature = feature_index[1])
sprintf("Feature 1: %i; Feature 2: %i; Feature 3: %i",sum(tempFeature$feature==1),sum(tempFeature$feature==2),sum(tempFeature$feature==3))
## [1] "Feature 1: 10; Feature 2: 9; Feature 3: 16"
#no response subjects
removeSub = temp$subID[temp$num_noresponses>trial_thre]
totalData = totalData%>%filter(!subID %in% removeSub)
demographic_information = demographic_information%>%filter(!SubID %in%removeSub)
sprintf("remove no response subjects: %i",length(removeSub))
## [1] "remove no response subjects: 0"
Restrict age
#select right age
remainSub = demographic_information$SubID[demographic_information$Age<=age_thre]
demographic_information_remain = filter(demographic_information,SubID%in%remainSub)
summary(demographic_information_remain$Age)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 18.00 22.00 25.00 26.00 31.75 35.00
ggplot(demographic_information_remain, aes(Age)) +
geom_histogram()+
geom_vline(xintercept=median(demographic_information_remain$Age), linetype="dashed", color = "red", size=0.5)+
#geom_vline(xintercept=mean(demographic_information$Age), linetype="dashed", color = "blue", size=0.5)+
labs(title = "Age Distribution",x = "age", y = "counts")+
plotformat
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

genderCount = table(demographic_information_remain$Gender)
EthnicityCount = table(demographic_information_remain$Ethnicity)
RaceCount = table(demographic_information_remain$Race)
genderCount
##
## F M
## 15 19
EthnicityCount
##
## HL NHL
## 2 32
RaceCount
##
## A AA M NH O W
## 7 1 3 1 1 21
#remove subjects who are outside of the age range
totalData = totalData %>%filter(subID %in%remainSub)
temp = totalData %>% group_by(subID) %>% summarize(num_noresponses= sum(keys==-1), trialNum = length(subID))
sprintf("total trial number: %i; Number of subjects %i",temp$trialNum[1],dim(temp)[1])
## [1] "total trial number: 84; Number of subjects 34"
temp
## # A tibble: 34 x 3
## subID num_noresponses trialNum
## <int> <int> <int>
## 1 1 22 84
## 2 2 0 84
## 3 3 1 84
## 4 4 2 84
## 5 5 0 84
## 6 6 1 84
## 7 7 1 84
## 8 8 0 84
## 9 9 0 84
## 10 10 2 84
## # ... with 24 more rows
ggplot(temp, aes( y= num_noresponses, x= subID))+
geom_point()+
geom_hline(yintercept=trial_thre, linetype="dashed", color = "red", size=0.5)+
labs(title="No responses", x ="subjuect ID", y = "number of no responses")+
plotformat

#check number of subjects for each feature
tempFeature = totalData %>% group_by(subID) %>%summarize(feature = feature_index[1])
sprintf("Feature 1: %i; Feature 2: %i; Feature 3: %i",sum(tempFeature$feature==1),sum(tempFeature$feature==2),sum(tempFeature$feature==3))
## [1] "Feature 1: 9; Feature 2: 9; Feature 3: 16"
Add conditions
summarize = dplyr::summarize
completeFnames = unlist(completeFnames)
#trial conditions: different:0; same:1 (same as keys)
totalData$cond = NA;
totalData$cond[totalData$Fimg==totalData$Simg]=1;
totalData$cond[totalData$Fimg!=totalData$Simg]=0;
totalData$level_diff = abs(totalData$Simg-totalData$Fimg);
#Assign pair identity (ignore order)
totalData$pairIdentity = NA;
totalData$pairIdentity[totalData$cond==1&totalData$Fimg==1]=1
totalData$pairIdentity[totalData$cond==1&totalData$Fimg==2]=2
totalData$pairIdentity[totalData$cond==1&totalData$Fimg==3]=3
totalData$pairIdentity[totalData$cond==1&totalData$Fimg==4]=4
totalData$pairIdentity[totalData$cond==1&totalData$Fimg==5]=5
totalData$pairIdentity[totalData$cond==1&totalData$Fimg==6]=6
totalData$pairIdentity[totalData$cond==1&totalData$Fimg==7]=7
totalData$pairIdentity[totalData$Fimg==1&totalData$Simg==2]=12
totalData$pairIdentity[totalData$Fimg==2&totalData$Simg==1]=12
totalData$pairIdentity[totalData$Fimg==1&totalData$Simg==3]=13
totalData$pairIdentity[totalData$Fimg==3&totalData$Simg==1]=13
totalData$pairIdentity[totalData$Fimg==1&totalData$Simg==4]=14
totalData$pairIdentity[totalData$Fimg==4&totalData$Simg==1]=14
totalData$pairIdentity[totalData$Fimg==1&totalData$Simg==5]=15
totalData$pairIdentity[totalData$Fimg==5&totalData$Simg==1]=15
totalData$pairIdentity[totalData$Fimg==1&totalData$Simg==6]=16
totalData$pairIdentity[totalData$Fimg==6&totalData$Simg==1]=16
totalData$pairIdentity[totalData$Fimg==1&totalData$Simg==7]=17
totalData$pairIdentity[totalData$Fimg==7&totalData$Simg==1]=17
totalData$pairIdentity[totalData$Fimg==2&totalData$Simg==3]=23
totalData$pairIdentity[totalData$Fimg==3&totalData$Simg==2]=23
totalData$pairIdentity[totalData$Fimg==2&totalData$Simg==4]=24
totalData$pairIdentity[totalData$Fimg==4&totalData$Simg==2]=24
totalData$pairIdentity[totalData$Fimg==2&totalData$Simg==5]=25
totalData$pairIdentity[totalData$Fimg==5&totalData$Simg==2]=25
totalData$pairIdentity[totalData$Fimg==2&totalData$Simg==6]=26
totalData$pairIdentity[totalData$Fimg==6&totalData$Simg==2]=26
totalData$pairIdentity[totalData$Fimg==2&totalData$Simg==7]=27
totalData$pairIdentity[totalData$Fimg==7&totalData$Simg==2]=27
totalData$pairIdentity[totalData$Fimg==3&totalData$Simg==4]=34
totalData$pairIdentity[totalData$Fimg==4&totalData$Simg==3]=34
totalData$pairIdentity[totalData$Fimg==3&totalData$Simg==5]=35
totalData$pairIdentity[totalData$Fimg==5&totalData$Simg==3]=35
totalData$pairIdentity[totalData$Fimg==3&totalData$Simg==6]=36
totalData$pairIdentity[totalData$Fimg==6&totalData$Simg==3]=36
totalData$pairIdentity[totalData$Fimg==3&totalData$Simg==7]=37
totalData$pairIdentity[totalData$Fimg==7&totalData$Simg==3]=37
totalData$pairIdentity[totalData$Fimg==4&totalData$Simg==5]=45
totalData$pairIdentity[totalData$Fimg==5&totalData$Simg==4]=45
totalData$pairIdentity[totalData$Fimg==4&totalData$Simg==6]=46
totalData$pairIdentity[totalData$Fimg==6&totalData$Simg==4]=46
totalData$pairIdentity[totalData$Fimg==4&totalData$Simg==7]=47
totalData$pairIdentity[totalData$Fimg==7&totalData$Simg==4]=47
totalData$pairIdentity[totalData$Fimg==5&totalData$Simg==6]=56
totalData$pairIdentity[totalData$Fimg==6&totalData$Simg==5]=56
totalData$pairIdentity[totalData$Fimg==5&totalData$Simg==7]=57
totalData$pairIdentity[totalData$Fimg==7&totalData$Simg==5]=57
totalData$pairIdentity[totalData$Fimg==6&totalData$Simg==7]=67
totalData$pairIdentity[totalData$Fimg==7&totalData$Simg==6]=67
totalData$pairIdentity = as.factor(totalData$pairIdentity)
summarize = dplyr::summarize
#Times
TimesRT = totalData %>% group_by(subID,pairIdentity,feature_index,cond)%>%summarize(Frt = rt[1],Srt = rt[2], Trt = rt[3], Ftrial = trialNum[1],Strial = trialNum[2],Ttrial = trialNum[3])
TimesRT_long = gather(TimesRT, response_type, number_resp,Frt,Srt,Trt)
ggplot(subset(TimesRT_long, cond==1), aes(x = pairIdentity, y = number_resp, group = pairIdentity, color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
ylim(0,2500)+
facet_wrap(response_type~feature_index)+
labs(title="Same", x = "level", y = "RT")+
plotformat
## Warning: Removed 9 rows containing missing values (geom_point).

ggplot(subset(TimesRT_long, cond==0), aes(x = pairIdentity, y = number_resp, group = pairIdentity, color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(response_type~feature_index)+
labs(title="Different", x = "Same level", y = "RT")+
plotformat

TimesRTcorrect = totalData %>% group_by(subID,pairIdentity,feature_index,cond)%>%filter(accuracy==1) %>%summarize(Frt = rt[1],Srt = rt[2], Trt = rt[3], Ftrial = trialNum[1],Strial = trialNum[2],Ttrial = trialNum[3])
TimesRTcorrect_long = gather(TimesRTcorrect, response_type, number_resp,Frt,Srt,Trt)
ggplot(subset(TimesRTcorrect_long, cond==1), aes(x = pairIdentity, y = number_resp, group = pairIdentity, color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(response_type~feature_index)+
labs(title="Correct same", x = "Same level", y = "RT")+
plotformat
## Warning: Removed 178 rows containing non-finite values (stat_boxplot).
## Warning: Removed 178 rows containing missing values (geom_point).

ggplot(subset(TimesRTcorrect_long, cond==0), aes(x = pairIdentity, y = number_resp, group = pairIdentity, color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(response_type~feature_index,strip.position = 'bottom')+
labs(title="Correct different", x = "Same level", y = "RT")+
theme_facet()
## Warning: Removed 490 rows containing non-finite values (stat_boxplot).
## Warning: Removed 490 rows containing missing values (geom_point).

Behavior analysis
summarize = dplyr::summarize
basic = totalData %>% filter(keys>=0)%>% group_by(subID)%>% summarize(num_noresposnes = sum(keys==-1), num_same_resp = sum(keys==1), num_diff_resp = sum(keys==0), num_same_trials =sum(cond==1), num_diff_trials = sum(cond==0),
hit = sum(keys==1&cond==1),
fa= sum(keys==1&cond==0),
cr = sum(keys==0&cond==0),
miss = sum(keys==0&cond==1),
HitRate =sum(keys==1&cond==1)/sum(cond==1),
FARate = sum(keys==1&cond==0)/sum(cond==0),
CRRate = sum(keys==0&cond==0)/sum(cond==0),
MissRate = sum(keys==0&cond==1)/sum(cond==1),
d_p = qnorm(HitRate)-qnorm(FARate))
basic
## # A tibble: 34 x 15
## subID num_noresposnes num_same_resp num_diff_resp num_same_trials
## <int> <int> <int> <int> <int>
## 1 1 0 23 39 15
## 2 2 0 35 49 21
## 3 3 0 30 53 20
## 4 4 0 31 51 21
## 5 5 0 31 53 21
## 6 6 0 39 44 21
## 7 7 0 41 42 21
## 8 8 0 31 53 21
## 9 9 0 39 45 21
## 10 10 0 31 51 21
## # ... with 24 more rows, and 10 more variables: num_diff_trials <int>,
## # hit <int>, fa <int>, cr <int>, miss <int>, HitRate <dbl>,
## # FARate <dbl>, CRRate <dbl>, MissRate <dbl>, d_p <dbl>
#Plotting
basic_longform = gather(basic, response_type, number_resp, HitRate,FARate,CRRate,MissRate)
head(basic_longform)
## # A tibble: 6 x 13
## subID num_noresposnes num_same_resp num_diff_resp num_same_trials
## <int> <int> <int> <int> <int>
## 1 1 0 23 39 15
## 2 2 0 35 49 21
## 3 3 0 30 53 20
## 4 4 0 31 51 21
## 5 5 0 31 53 21
## 6 6 0 39 44 21
## # ... with 8 more variables: num_diff_trials <int>, hit <int>, fa <int>,
## # cr <int>, miss <int>, d_p <dbl>, response_type <chr>,
## # number_resp <dbl>
ggplot(basic_longform, aes(x = response_type, y = number_resp, color = response_type))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
labs(title="Proportaion response type", x = "response type", y = "proportion")+
plotformat

#d-p
ggplot(basic, aes(x = subID, y = d_p, color = as.factor(subID)))+
geom_point(size=3)+
labs(title="d prime", x = "subject", y = "d prime")+
plotformat

ggplot(basic,aes(d_p))+
geom_histogram()+
labs(title="d prime histogram", x = "d prime", y = "counts")+
plotformat
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 4 rows containing non-finite values (stat_bin).

check d-p for each feature
#Add d prime to post survey file
postsurvey_d_p = postsurvey
postsurvey_d_p = postsurvey_d_p%>%filter(SubID %in% remainSub)
postsurvey_d_p = cbind(postsurvey_d_p, "dataSubID" = basic$subID, "d_p"=basic$d_p)
ggplot(postsurvey_d_p,aes(x = feature,y = d_p, color = as.factor(feature)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_point(alpha = 0.5, size = 3)+
plotformat
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).

#stats
temp = subset(postsurvey_d_p, !is.infinite(postsurvey_d_p$d_p))
summary(aov(d_p~SubID+feature, temp))
## Df Sum Sq Mean Sq F value Pr(>F)
## SubID 1 1.044 1.0443 1.592 0.218
## feature 1 0.000 0.0003 0.000 0.984
## Residuals 27 17.711 0.6560
#save summary file
write.csv(postsurvey_d_p, file = paste0(postsurvey_new_fname,".csv"))
Remove subjects with low d-p
remain_dp = basic$subID[basic$d_p>d_p_thre]
sprintf("remove d prime lower than %f %i",d_p_thre, length(remain_dp))
## [1] "remove d prime lower than 0.500000 28"
totalData = totalData %>%filter(subID%in%remain_dp)
#check feature number
tempFeature = totalData %>% group_by(subID) %>%summarize(feature = feature_index[1])
sprintf("Feature 1: %i; Feature 2: %i; Feature 3: %i",sum(tempFeature$feature==1),sum(tempFeature$feature==2),sum(tempFeature$feature==3))
## [1] "Feature 1: 7; Feature 2: 7; Feature 3: 14"
##########
basicFeature = totalData %>% filter(keys>=0)%>% group_by(subID,feature_index)%>% summarize(num_noresposnes = sum(keys==-1), num_same_resp = sum(keys==1), num_diff_resp = sum(keys==0), num_same_trials =sum(cond==1), num_diff_trials = sum(cond==0),
hit = sum(keys==1&cond==1),
fa= sum(keys==1&cond==0),
cr = sum(keys==0&cond==0),
miss = sum(keys==0&cond==1),
HitRate =sum(keys==1&cond==1)/sum(cond==1),
FARate = sum(keys==1&cond==0)/sum(cond==0),
CRRate = sum(keys==0&cond==0)/sum(cond==0),
MissRate = sum(keys==0&cond==1)/sum(cond==1),
d_p = qnorm(HitRate)-qnorm(FARate))
basicFeature_longform = gather(basicFeature, response_type, number_resp, HitRate,FARate,CRRate,MissRate)
head(basicFeature_longform)
## # A tibble: 6 x 14
## # Groups: subID [6]
## subID feature_index num_noresposnes num_same_resp num_diff_resp
## <int> <dbl> <int> <int> <int>
## 1 1 3 0 23 39
## 2 2 2 0 35 49
## 3 3 3 0 30 53
## 4 4 1 0 31 51
## 5 5 1 0 31 53
## 6 6 1 0 39 44
## # ... with 9 more variables: num_same_trials <int>, num_diff_trials <int>,
## # hit <int>, fa <int>, cr <int>, miss <int>, d_p <dbl>,
## # response_type <chr>, number_resp <dbl>
ggplot(basicFeature_longform, aes(x = response_type, y = number_resp, color = response_type))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
labs(title="Proportaion response type by feature", x = "response type", y = "proportion")+
plotformat

ggplot(basicFeature, aes(x = subID, y = d_p, group = feature_index, color = as.factor(feature_index)))+
geom_point(size=3)+
plotformat

###########
basicLevel = totalData %>% filter(keys>=0)%>% group_by(subID,level_diff)%>% summarize(num_noresposnes = sum(keys==-1), num_same_resp = sum(keys==1), num_diff_resp = sum(keys==0), num_same_trials =sum(cond==1), num_diff_trials = sum(cond==0),
hit = sum(keys==1&cond==1),
fa= sum(keys==1&cond==0),
cr = sum(keys==0&cond==0),
miss = sum(keys==0&cond==1),
HitRate =sum(keys==1&cond==1)/sum(cond==1),
FARate = sum(keys==1&cond==0)/sum(cond==0),
CRRate = sum(keys==0&cond==0)/sum(cond==0),
MissRate = sum(keys==0&cond==1)/sum(cond==1),
d_p = qnorm(HitRate)-qnorm(FARate))
basicLevel_longform = gather(basicLevel, response_type, number_resp, HitRate,FARate,CRRate,MissRate)
head(basicLevel_longform)
## # A tibble: 6 x 14
## # Groups: subID [1]
## subID level_diff num_noresposnes num_same_resp num_diff_resp
## <int> <dbl> <int> <int> <int>
## 1 1 0 0 8 7
## 2 1 1 0 5 7
## 3 1 2 0 2 7
## 4 1 3 0 6 5
## 5 1 4 0 0 7
## 6 1 5 0 1 4
## # ... with 9 more variables: num_same_trials <int>, num_diff_trials <int>,
## # hit <int>, fa <int>, cr <int>, miss <int>, d_p <dbl>,
## # response_type <chr>, number_resp <dbl>
ggplot(basicLevel_longform, aes(x = response_type, y = number_resp, color = response_type))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~level_diff,nrow = 1)+
labs(title="Proportaion response type by difficulty level", x = "response type", y = "proportion")+
theme_facet()
## Warning: Removed 392 rows containing non-finite values (stat_boxplot).
## Warning: Removed 392 rows containing missing values (geom_point).

###########
basicLevelFeature = totalData %>% filter(keys>=0)%>% group_by(subID,level_diff,feature_index)%>% summarize(num_noresposnes = sum(keys==-1), num_same_resp = sum(keys==1), num_diff_resp = sum(keys==0), num_same_trials =sum(cond==1), num_diff_trials = sum(cond==0),
hit = sum(keys==1&cond==1),
fa= sum(keys==1&cond==0),
cr = sum(keys==0&cond==0),
miss = sum(keys==0&cond==1),
HitRate =sum(keys==1&cond==1)/sum(cond==1),
FARate = sum(keys==1&cond==0)/sum(cond==0),
CRRate = sum(keys==0&cond==0)/sum(cond==0),
MissRate = sum(keys==0&cond==1)/sum(cond==1),
d_p = qnorm(HitRate)-qnorm(FARate))
basicLevelFeature_longform = gather(basicLevelFeature, response_type, number_resp, HitRate,FARate,CRRate,MissRate)
head(basicLevelFeature_longform)
## # A tibble: 6 x 15
## # Groups: subID, level_diff [6]
## subID level_diff feature_index num_noresposnes num_same_resp
## <int> <dbl> <dbl> <int> <int>
## 1 1 0 3 0 8
## 2 1 1 3 0 5
## 3 1 2 3 0 2
## 4 1 3 3 0 6
## 5 1 4 3 0 0
## 6 1 5 3 0 1
## # ... with 10 more variables: num_diff_resp <int>, num_same_trials <int>,
## # num_diff_trials <int>, hit <int>, fa <int>, cr <int>, miss <int>,
## # d_p <dbl>, response_type <chr>, number_resp <dbl>
ggplot(basicLevelFeature_longform, aes(x = response_type, y = number_resp, color = response_type))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(feature_index~level_diff,nrow = 3,strip.position = "bottom")+
labs(title="Proportaion response type by difficulty level", x = "level diff", y = "proportion")+
theme_facet()
## Warning: Removed 392 rows containing non-finite values (stat_boxplot).
## Warning: Removed 392 rows containing missing values (geom_point).

reaction time and difficulty levels
summarize = dplyr::summarize
responseData = totalData %>%filter(keys>=0,accuracy==1)
ggplot(responseData, aes(x = level_diff, y = rt, group = as.factor(level_diff), color = as.factor(level_diff)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
ylim(0,2500)+
labs(title="Reaction type by difficulty levels", x = "response type", y = "RT (ms)")+
plotformat

responseData_firstHalf = totalData %>%filter(keys>=0,accuracy==1,trialNum<42)
ggplot(responseData_firstHalf, aes(x = level_diff, y = rt, group = as.factor(level_diff), color = as.factor(level_diff)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
ylim(0,2500)+
labs(title="Reaction type by difficulty levels -first", x = "response type", y = "RT (ms)")+
plotformat

responseData_lastHalf = totalData %>%filter(keys>=0,accuracy==1,trialNum>42)
ggplot(responseData_lastHalf, aes(x = level_diff, y = rt, group = as.factor(level_diff), color = as.factor(level_diff)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
ylim(0,2500)+
labs(title="Reaction type by difficulty levels -last", x = "response type", y = "RT (ms)")+
plotformat

#temp = responseData %>% group_by(subID, level_diff, feature_index) %>%summarise(mean_RT = mean(rt))
#ggplot(temp,aes(x = level_diff, y = mean_RT, group = level_diff))+
# geom_boxplot(fill = "white",lwd = 1)+
# geom_jitter(width=0.2,alpha = 0.5)+
# facet_wrap(~feature_index)+
# labs(title="Proportaion response type", x = "response type", y = "RT (ms)")+
# plotformat
######
responseData = totalData %>%filter(keys>=0,accuracy==1,level_diff==0)
ggplot(responseData, aes(x = pairIdentity, y = rt, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
ylim(0,2500)+
labs(title="Reaction type for same pairs by levels", x = "levels", y = "RT (ms)")+
plotformat

responseData = totalData %>%filter(keys>=0,accuracy==1,level_diff==1)
ggplot(responseData, aes(x = pairIdentity, y = rt, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
ylim(0,2500)+
labs(title="Reaction type for difference -- level 1", x = "levels", y = "RT (ms)")+
plotformat

responseData = totalData %>%filter(keys>=0,accuracy==1,level_diff==2)
ggplot(responseData, aes(x = pairIdentity, y = rt, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
ylim(0,2500)+
labs(title="Reaction type for difference -- level 2", x = "levels", y = "RT (ms)")+
plotformat

responseData = totalData %>%filter(keys>=0,accuracy==1,level_diff==3)
ggplot(responseData, aes(x = pairIdentity, y = rt, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
ylim(0,2500)+
labs(title="Reaction type for difference -- level 3", x = "levels", y = "RT (ms)")+
plotformat

responseData = totalData %>%filter(keys>=0,accuracy==1,level_diff==4)
ggplot(responseData, aes(x = pairIdentity, y = rt, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
ylim(0,2500)+
labs(title="Reaction type for difference -- level 4", x = "levels", y = "RT (ms)")+
plotformat

responseData = totalData %>%filter(keys>=0,accuracy==1,level_diff==5)
ggplot(responseData, aes(x = pairIdentity, y = rt, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
ylim(0,2500)+
labs(title="Reaction type for difference -- level 5", x = "levels", y = "RT (ms)")+
plotformat

responseData = totalData %>%filter(keys>=0,accuracy==1,level_diff==6)
ggplot(responseData, aes(x = pairIdentity, y = rt, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
ylim(0,2500)+
labs(title="Reaction type for difference -- level 6", x = "levels", y = "RT (ms)")+
plotformat

accuracy and difficulty levels
accuracyData = totalData %>%filter(keys>=0)%>%group_by(subID,feature_index,level_diff)%>%summarize(meanAccuracy = sum(accuracy==1)/length(subID))
ggplot(accuracyData, aes(x = level_diff, y = meanAccuracy, group = as.factor(level_diff), color = as.factor(level_diff)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
labs(title="Accuracy by difficulty levels", x = "difficulty level", y = "proportion correct")+
plotformat

accuracy and pair
accuracyDataPairSame = totalData %>%filter(keys>=0,cond==1)%>%group_by(subID,feature_index,pairIdentity)%>%summarize(propAccuracy = sum(accuracy==1)/length(subID))
ggplot(accuracyDataPairSame, aes(x = pairIdentity, y = propAccuracy, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_point(alpha = 0.5)+
#geom_jitter(width=0.05,alpha = 0.5)+
facet_wrap(~feature_index)+
labs(title="Accuracy by same pairs", x = "difficulty level", y = "proportion correct")+
plotformat

accuracyDataPairDiff = totalData %>%filter(keys>=0,cond==0)%>%group_by(subID,feature_index,pairIdentity)%>%summarize(propAccuracy = sum(accuracy==1)/length(subID))
ggplot(accuracyDataPairDiff, aes(x = as.factor(pairIdentity), y = propAccuracy, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_point(alpha = 0.5)+
#geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
labs(title="Accuracy by different pairs", x = "difficulty level", y = "proportion correct")+
plotformat

accuracyDataPairDiff_level = totalData %>%filter(keys>=0,cond==0)%>%group_by(subID,feature_index,pairIdentity)%>%summarize(propAccuracy = sum(accuracy==1)/length(subID), level_diff = level_diff[1])
ggplot(filter(accuracyDataPairDiff_level,level_diff==1), aes(x = as.factor(pairIdentity), y = propAccuracy, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_point(alpha = 0.5)+
#geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
labs(title="Accuracy by different pairs --level 01", x = "difficulty level", y = "proportion correct")+
plotformat

ggplot(filter(accuracyDataPairDiff_level,level_diff==2), aes(x = as.factor(pairIdentity), y = propAccuracy, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_point(alpha = 0.5)+
#geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
labs(title="Accuracy by different pairs --level 02", x = "difficulty level", y = "proportion correct")+
plotformat

ggplot(filter(accuracyDataPairDiff_level,level_diff==3), aes(x = as.factor(pairIdentity), y = propAccuracy, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_point(alpha = 0.5)+
#geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
labs(title="Accuracy by different pairs --level 03", x = "difficulty level", y = "proportion correct")+
plotformat

ggplot(filter(accuracyDataPairDiff_level,level_diff==4), aes(x = as.factor(pairIdentity), y = propAccuracy, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_point(alpha = 0.5)+
#geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
labs(title="Accuracy by different pairs --level 04", x = "difficulty level", y = "proportion correct")+
plotformat

ggplot(filter(accuracyDataPairDiff_level,level_diff==5), aes(x = as.factor(pairIdentity), y = propAccuracy, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_point(alpha = 0.5)+
#geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
labs(title="Accuracy by different pairs --level 05", x = "difficulty level", y = "proportion correct")+
plotformat

ggplot(filter(accuracyDataPairDiff_level,level_diff==6), aes(x = as.factor(pairIdentity), y = propAccuracy, group = as.factor(pairIdentity), color = as.factor(pairIdentity)))+
geom_boxplot(fill = "white",lwd = 1)+
geom_point(alpha = 0.5)+
#geom_jitter(width=0.2,alpha = 0.5)+
facet_wrap(~feature_index)+
labs(title="Accuracy by different pairs --level 06", x = "difficulty level", y = "proportion correct")+
plotformat
